const { Wallet: SecretWallet } = require('secretjs');
const {Secp256k1} =require('@cosmjs/crypto')
exports.createWalletFromMnemonic = function (mnemonic) {
    return new SecretWallet(mnemonic, {
        bech32Prefix: "ghm",
        coinType: 928,
    });
}
exports.createWalletFromPubkey = async function (wallte){   
    let    wallet=new SecretWallet('',{
        bech32Prefix: "ghm",
        coinType: 928,
    })
        wallet.address=wallte.address
        const seed =Buffer.from(wallte.privateKey, 'hex')
        wallet.privateKey=seed                          
        const makeKeypair = await Secp256k1.makeKeypair(seed)
        const publickey = await Secp256k1.compressPubkey(makeKeypair.pubkey)                           
        wallet.publicKey=publickey
        wallet.mnemonic=''	
        // console.log(wallet);
    return wallet
    }